package com.qingfeng.coupon.bean;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.qingfeng.coupon.constant.CouponCategory;
import com.qingfeng.coupon.constant.CouponDistributeType;
import com.qingfeng.coupon.constant.CouponExpireType;
import com.qingfeng.coupon.constant.CouponUseType;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import java.util.Date;
import java.util.List;

/**
 * @author zhangyuefei
 * @version 1.0
 * @date 2020/5/26 2:07 下午
 */
@ApiModel(value = "优惠券模版")
@Data
@TableName(value = "coupon_template")
public class CouponTemplate {
    /**
     * 主键
     */
    @TableId(value = "id", type = IdType.AUTO)
    @ApiModelProperty(value = "主键")
    private Long id;

    /**
     * 优惠券分类
     * 1。
     */
    @TableField(value = "category")
    @ApiModelProperty(value = "优惠券分类",example = "1",required = true)
    private CouponCategory category;

    /**
     * 优惠券名称
     */
    @TableField(value = "name")
    @ApiModelProperty(value = "优惠券名称",example = "test-name",required = true)
    private String name;

    /**
     * 优惠券模版编码
     */
    @TableField(value = "code")
    private String code;

    /**
     * 优惠券logo
     */
    @TableField(value = "logo")
    private String logo;

    /**
     * 总数
     */
    @TableField(value = "count")
    @ApiModelProperty(value = "总数",example = "100",required = true)
    private Integer count;

    /**
     * 已分发数量
     */
    @TableField(value = "distribute_count")
    @ApiModelProperty(value = "已分发数量",required = false)
    private Integer distributeCount;

    /**
     * 已使用数量
     */
    @TableField(value = "use_count")
    @ApiModelProperty(value = "已使用数量",required = false)
    private Integer useCount;

    /**
     * 已过期数量
     */
    @TableField(value = "expire_count")
    @ApiModelProperty(value = "已过期数量",required = false)
    private Integer expireCount;

    /**
     * 优惠券描述
     */
    @TableField(value = "intro")
    @ApiModelProperty(value = "优惠券描述",required = false)
    private String intro;

    /**
     * 是否可用（发放）
     */
    @TableField(value = "available")
    @ApiModelProperty(value = "是否可用（发放）",required = false)
    private Boolean available;

    /**
     * 是否过期
     */
    @TableField(value = "expired")
    @ApiModelProperty(value = "是否过期",required = false)
    private Boolean expired;

    /**
     * 产品线
     */
    @TableField(value = "product_line")
    @ApiModelProperty(value = "产品线",required = false)
    private Integer productline;

    /**
     * 创建时间
     */
    @TableField(value = "create_time")
    @ApiModelProperty(value = "创建时间",required = false)
    private Date createTime;

    /**
     * 创建用户
     */
    @TableField(value = "user_id")
    @ApiModelProperty(value = "创建用户",required = false)
    private Long userId;

    /**
     * 分发场景，1单商品，2达到总金额
     */
    @TableField(value = "distribute_type")
    @ApiModelProperty(value = "分发场景，1单商品，2达到总金额",example = "1",required = true)
    private CouponDistributeType distributeType;

    /**
     * 每人最多可领取几张
     */
    @TableField(value = "distribute_user_limite")
    @ApiModelProperty(value = "每人最多可领取几张",example = "1",required = true)
    private Integer distributeUserLimite;

    /**
     * 每天限领多少张
     */
    @TableField(value = "distribute_day_limite")
    @ApiModelProperty(value = "每天限领多少张",example = "10",required = false)
    private Integer distributeDayLimite;



    /**
     * 分发最低购买金额
     */
    @TableField(value = "distribute_base")
    @ApiModelProperty(value = "分发最低购买金额/分",example = "100",required = true)
    private Integer distributeBase;

    /**
     * 开始分发时间
     */
    @TableField(value = "distribute_start")
    @ApiModelProperty(value = "开始分发时间",required = true)
    private Date distributeStart;

    /**
     * 结束分发时间
     */
    @TableField(value = "distribute_end")
    @ApiModelProperty(value = "结束分发时间",required = true)
    private Date distributeEnd;

    /**
     * 有效期规则，1固定日期，2固定时间长度
     */
    @TableField(value = "expire_period")
    @ApiModelProperty(value = "有效期规则，1固定日期，2固定时间长度",example = "1",required = true)
    private CouponExpireType expirePeriod;

    /**
     * 有效期间隔，单位天数
     */
    @TableField(value = "expire_gap")
    @ApiModelProperty(value = "有效期间隔，单位天数",example = "1",required = false)
    private Integer expireGap;

    /**
     * 有效期开始时间
     */
    @TableField(value = "expire_start")
    @ApiModelProperty(value = "有效期开始时间")
    private Date expireStart;

    /**
     * 有效期结束时间
     */
    @TableField(value = "expire_end")
    @ApiModelProperty(value = "有效期结束时间")
    private Date expireEnd;

    /**
     * 使用规则-规则类型，1指定金额满减，2指定消费商品类型满减，3指定消费商品满减,
     */
    @TableField(value = "use_type")
    @ApiModelProperty(value = "使用规则-规则类型，" +
            "1指定金额满减，" +
            "2指定消费商品类型满减，" +
            "3指定消费商品满减,",required = true,example = "1")
    private CouponUseType useType;


    /**
     * 满减额度,减20
     */
    @TableField(value = "discount_quota")
    @ApiModelProperty(value = "满减额度,减20",example = "2000",required = true)
    private Integer discountQuota;

    /**
     * 满减基准
     */
    @TableField(value = "discount_base")
    @ApiModelProperty(value = "满减基准",example = "10000",required = true)
    private Integer discountBase;

    /**
     * 权重，用于判断优惠券是否可以叠加使用
     */
    @TableField(value = "weight")
    @ApiModelProperty(value = "权重，用于判断优惠券是否可以叠加使用",required = false)
    private Integer weight;

    /**
     * 店铺id，如果null，则所用店铺通用
     */
    @TableField(value = "store_id")
    @ApiModelProperty(value = "店铺id，如果null，则所用店铺通用")
    private Integer storeId;


    @TableField(exist = false)
    @ApiModelProperty(value = "分发商品",required = false)
    private transient List<CouponDistributeGoods> distributeGoods;



    @TableField(exist = false)
    @ApiModelProperty(value = "可用优惠券商品",required = false)
    private transient List<CouponUseGoods> useGoods;


    @TableField(exist = false)
    @ApiModelProperty(value = "优惠券状态",required = false)
    private transient Integer status;


}
